$(document).ready(function(){

	var select_lang = document.getElementById("slelect_language");

	$("#slelect_language").change(function(){

		var select_lang =	$("#slelect_language option:selected").val();

		// alert(select_lang);

		if (select_lang == ('en')) {
  				window.location.href = "/vnpt-qavah/dev-front-end/auth/index/en";
		}else{
  				window.location.href = "/vnpt-qavah/dev-front-end/auth/index/vi";
		}
	});

	$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
		
     	var activeTab = $(e.target).text(); 

     	if (activeTab=="USER & GROUP") {
     		clear_myTabContent();
			$.ajax({
		        url: "/vnpt-qavah/dev-front-end/layout/manage_user_group",
					success: function(result){
						//alert(result);
						$("#myTabContent").html(result);
					},
					error:function(){
						$("#myTabContent").html('There is error while submit & loading');
					}
		    	});	
     	};

     	if (activeTab=="POSITION & DEPARTMENT") {
     		clear_myTabContent();
			$.ajax({
		        url: "/vnpt-qavah/dev-front-end/layout/manage_position_department",
					success: function(result){
						//alert(result);
						$("#myTabContent").html(result);
					},
					error:function(){
						$("#myTabContent").html('There is error while submit & loading');
					}
		    	});	
     	};

     	if (activeTab=="DOMAIN & DEVICE") {
     		// alert(activeTab);
     		clear_myTabContent();
			$.ajax({
		        url: "/vnpt-qavah/dev-front-end/layout/manage_domain_device",
					success: function(result){
						//alert(result);
						$("#myTabContent").html(result);
					},
					error:function(){
						$("#myTabContent").html('There is error while submit & loading');
					}
		    	});	
     	};

     	if (activeTab=="AUTHORIZATION") {
     		clear_myTabContent();
			$.ajax({
		        url: "/vnpt-qavah/dev-front-end/layout/manage_authorization",
					success: function(result){
						//alert(result);
						$("#myTabContent").html(result);
					},
					error:function(){
						$("#myTabContent").html('There is error while submit & loading');
					}
		    	});	
     	};
 	});

	function clear_myTabContent(){
		$("#myTabContent").empty();
	}

});